<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="java.util.*,linuxbox.todo.logic.*,linuxbox.BoxStatic" %>
<%@ taglib uri="/linuxbox/common.tld" prefix="common" %>

<table width="100%" border=1 cellpadding=2 cellspacing=0 bgColor=#dddddd>
  <tr>
    <td bgcolor="#dddddd" height="20">
      <table width="100%" border=0 cellpadding=2 cellspacing=0 bgColor=#dddddd>
        <tr>
          <td nowrap>
            <p align="center"><b><font color=#d05000>My Todo List</font></b></p>
          </td>
          <td nowrap align=right>
            <a href="<%=BoxStatic.jspDir%>todo/BoxTodo.jsp">More Todos...</a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
<%
  BoxTodo home = new BoxTodo();
  int entriesPerPage = sec.getConfigInt("todo", "HomePage", "Entries Per HomePage");

  Iterator it = home.getTodos(curID, home.VT_CURRENT, "duedate", true, 0, entriesPerPage);
  if ( it != null && it.hasNext() )
  {
    int count=0;
%>
  <tr>
    <td>
      <TABLE cellSpacing=1 cellPadding=0 width="100%" border=0 bgColor=#dddddd>
        <TR bgColor=#7EC1F3>
          <TH>Due Date</TH>
          <TH>Subject</TH>
          <TH>Priority</TH>
        </TR>
        <common:Iteration name="entry" type="linuxbox.todo.logic.BoxTodoEntry" group="<%=it%>">
          <tr <% if ((count++ % 2) == 0) out.print("bgcolor=#f0f0f0"); %>>
            <TD>
              <%
                if (entry.getDueDate().before(new java.util.Date()))
                  out.print("<font color=#ff0000>"+entry.getDueDateString()+"</font>");
                else
                  out.print(entry.getDueDateString());
              %>
            </TD>
            <TD><a href="<%=BoxStatic.servletDir%>BoxTodoAction?SubmitEdit=edit&ID=<%=entry.getID()%>"><%=entry.getSubject()%></a></TD>
            <TD><%=home.getPriorityString(entry.getPriority())%></TD>
          </TR>
        </common:Iteration>
      </table>
    </td>
  </tr>
<%
  }
  else
  {
    out.print("<tr><td>No tasks</td></tr>");
  }
%>
</table>
